package org.road0329.tools.proto_parse_tool.ems.qgdw3761.utils;

import org.road0329.tools.proto_parse_tool.ems.dataobject.gw.afn09.RtuConfigF1;
import org.road0329.tools.proto_parse_tool.utils.ProtocolGW_09Util;
import org.road0329.tools.proto_parse_tool.utils.ProtocolUtils;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2018-09-13.
 */
@Component
public class Gw09RtuConfigUtil {

    private RtuConfigF1 parseRtuConfigF1Frame(byte[] byteValue, int index) {
        RtuConfigF1 rtuConfigF1 = new RtuConfigF1();
        rtuConfigF1.setFactoryCode(ProtocolUtils.ascii2String(byteValue, index, 4));
        index += 4;
        rtuConfigF1.setDeviceNo(ProtocolUtils.ascii2String(byteValue, index, 8));
        index += 8;
        rtuConfigF1.setSoftVersion(ProtocolUtils.ascii2String(byteValue, index, 4));
        index += 4;
        rtuConfigF1.setSoftPublishTime(ProtocolGW_09Util.parseA20(byteValue, index));
        index += 3;
        rtuConfigF1.setCapacityCode(ProtocolUtils.ascii2String(byteValue, index, 11));
        index += 11;
        rtuConfigF1.setProtocolVersion(ProtocolUtils.ascii2String(byteValue, index, 4));
        index += 4;
        rtuConfigF1.setHardVersion(ProtocolUtils.ascii2String(byteValue, index, 4));
        index += 4;
        rtuConfigF1.setHardPublishTime(ProtocolGW_09Util.parseA20(byteValue, index));

        return rtuConfigF1;
    }
}
